package io.renren.modules.zhaopin.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.zhaopin.entity.BackgroundCustomInfoEntity;
import io.renren.modules.zhaopin.service.BackgroundCustomInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 背调套餐
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2024-03-24 16:21:36
 */
@RestController
@RequestMapping("generator/backgroundcustominfo")
public class BackgroundCustomInfoController {
    @Autowired
    private BackgroundCustomInfoService backgroundCustomInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:backgroundcustominfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = backgroundCustomInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{customId}")
    @RequiresPermissions("generator:backgroundcustominfo:info")
    public R info(@PathVariable("customId") Long customId){
		BackgroundCustomInfoEntity backgroundCustomInfo = backgroundCustomInfoService.getById(customId);

        return R.ok().put("backgroundCustomInfo", backgroundCustomInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:backgroundcustominfo:save")
    public R save(@RequestBody BackgroundCustomInfoEntity backgroundCustomInfo){
		backgroundCustomInfoService.save(backgroundCustomInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:backgroundcustominfo:update")
    public R update(@RequestBody BackgroundCustomInfoEntity backgroundCustomInfo){
		backgroundCustomInfoService.updateById(backgroundCustomInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:backgroundcustominfo:delete")
    public R delete(@RequestBody Long[] customIds){
		backgroundCustomInfoService.removeByIds(Arrays.asList(customIds));

        return R.ok();
    }

}
